package com.project2.bean;

import lombok.Data;



/**
 * TODO
 *
 * @param
 * @author wj
 * @return
 */
@Data
public class ResultVo {
     String errmsg;
     int errno;
     Object data;

    public static ResultVo ok(Object data) {
        ResultVo baseRespVo = new ResultVo();
        baseRespVo.setErrmsg("成功");
        baseRespVo.setErrno(0);
        baseRespVo.setData(data);
        return baseRespVo;
    }
    public static ResultVo ok() {
        return ResultVo.ok(null);
    }

    public static ResultVo wrong(String errmsg) {
        ResultVo RespVo = new ResultVo();

        RespVo.setErrno(500);

        RespVo.setErrmsg(errmsg);
        return RespVo;

    }
    public static ResultVo ok(String errmsg,Integer errno) {
        ResultVo RespVo = new ResultVo();
        RespVo.setErrmsg(errmsg);
        RespVo.setErrno(errno);
        return RespVo;
    }

    public static <T> ResultVo invalidParameter(String message) {
        ResultVo resultVo = new ResultVo();
        resultVo.setErrno(400);
        resultVo.setErrmsg(message);
        return resultVo;
    }
}
